-
Notifications
You must be signed in to change notification settings - Fork 738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write new blocks and states to the database atomically #1285
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Can't wait to merge this so we have real atomic DB operations!
I've left one major(ish) comment and a few minor ones
store.store_cold_state(&state_root, &state)?; | ||
let mut ops: Vec<KeyValueStoreOp> = Vec::new(); | ||
store.store_cold_state(&state_root, &state, &mut ops)?; | ||
store.cold_db.do_atomically(ops)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This strikes me as odd when maybe the whole migration should be 2 DB transactions (copy to freezer, delete from hot), but I'm happy to postpone thinking about that until later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I overlooked this one. Happy to correct this in a separate PR.
) -> Result<(), Error> { | ||
let total_timer = metrics::start_timer(&metrics::BEACON_STATE_WRITE_TIMES); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This timer should probably stay for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be meaningless. The PR makes it so that the actual db write is executed at some other place in the code, during the call to do_atomically()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, of course! Lets delete BEACON_STATE_WRITE_TIMES
from beacon_node/store/src/metrics.rs
then, as it's now unused. I've also opened #1307 to track the state of the store metrics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to merge once the conflict is resolved!
ccd4307
to
e341c55
Compare
@paulhauner I've just tested this on Altona and it's performing well 💯 If you're OK to merge it I'll go ahead and merge tomorrow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A great feature implemented elegantly! Love it :)
(Mostly) fixes #692